home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-11-25 | 1.7 KB | 55 lines | [TEXT/ToyS] |
- tell application "Microsoft Excel 4.0"
- make document
- set Range "R2C1:R6C1" to {"Cars", "Planes", "Trucks", "Buses", "Totals"}
- set bold of Range "R6C1:R6C4" to true
- set Range "R2C2:R5C4" to 0
- set cell 2 of row 6 to "=sum(R2C2:R5C2)"
- set cell 3 of row 6 to "=sum(R2C3:R5C3)"
- set cell 4 of row 6 to "=sum(R2C4:R5C4)"
- end tell
- copy 0 to iregion
- repeat with region in {"North", "South", "West"}
- copy iregion + 1 to iregion
- tell application "Microsoft Excel 4.0"
- set formula of cell iregion + 1 of first row to region
- end tell
- tell application "Quill"
- copy region to regionName
- if not (exists window named regionName) then
- tell current application
- choose file with prompt "Where is the sales memo for the " & regionName & " region?"
- end tell
- open result
- end if
- copy (number of paragraphs in window named regionName) to clines
- end tell
- repeat with iline from 1 to clines
- tell application "Quill"
- copy paragraph iline of window regionName to theline
- copy 0 to r
- if theline contains "Cars" then
- copy 2 to r
- else if theline contains "Planes" then
- copy 3 to r
- else if theline contains "Trucks" then
- copy 4 to r
- else if theline contains "Buses" then
- copy 5 to r
- end if
- if r > 0 then
- copy word 2 of paragraph iline of window regionName to theword
- tell application "Microsoft Excel 4.0"
- set cell iregion + 1 of row r of first document to theword
- end tell
- end if
- end tell
- end repeat
- end repeat
- tell application "Microsoft Excel 4.0"
- copy "R1C1:R5C4" to selection
- make Chart
- set bounds of first window to {10, 100, 440, 360}
- set type of first Chart to three D Bar
- set title of first Chart to "Sales"
- set has legend of first Chart to true
- end tell